<?php
declare(strict_types=1);
/**
 * MineAdmin is committed to providing solutions for quickly building web applications
 * Please view the LICENSE file that was distributed with this source code,
 * For the full copyright and license information.
 * Thank you very much for using MineAdmin.
 *
 * @Author X.Mo<root@imoi.cn>
 * @Link   https://gitee.com/xmo/MineAdmin
 */

namespace Plugin\Message\Enums;

/**
 * 消息类型枚举
 */
enum MessageTypeEnum: int
{
    /**
     * 预警消息
     */
    case ALARM = 1;
    
    /**
     * 反馈消息
     */
    case CALLBACK = 2;
    
    /**
     * 系统消息
     */
    case SYSTEM = 3;
    
    /**
     * 获取消息类型描述
     * @return string
     */
    public function getDescription(): string
    {
        return match($this) {
            self::ALARM => '预警消息',
            self::CALLBACK => '反馈消息',
            self::SYSTEM => '系统消息',
        };
    }
    
    /**
     * 获取所有消息类型
     * @return array
     */
    public static function getAllTypes(): array
    {
        return [
            self::ALARM->value => self::ALARM->getDescription(),
            self::CALLBACK->value => self::CALLBACK->getDescription(),
            self::SYSTEM->value => self::SYSTEM->getDescription(),
        ];
    }
}